﻿Public Class ProductsForm

    Private Sub ProductsBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProductsBindingNavigatorSaveItem.Click
        Me.Validate()
        Me.ProductsBindingSource.EndEdit()
        If Me.NorthwindDataSet.Products.HasErrors Then

            For Each product As NorthwindDataSet.ProductsRow In NorthwindDataSet.Products
                If product.RowError <> String.Empty Then
                    MessageBox.Show(product.ProductName & ":" & product.RowError)
                End If
            Next
            MessageBox.Show("den sozo tipota")
        Else
            Me.TableAdapterManager.UpdateAll(Me.NorthwindDataSet)
            MessageBox.Show("ola kala")
        End If

    End Sub

    Private Sub ProductsForm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        'TODO: This line of code loads data into the 'NorthwindDataSet.Categories' table. You can move, or remove it, as needed.
        Me.CategoriesTableAdapter.Fill(Me.NorthwindDataSet.Categories)
        'TODO: This line of code loads data into the 'NorthwindDataSet.Suppliers' table. You can move, or remove it, as needed.
        Me.SuppliersTableAdapter.Fill(Me.NorthwindDataSet.Suppliers)
        'TODO: This line of code loads data into the 'NorthwindDataSet.Products' table. You can move, or remove it, as needed.
        Me.ProductsTableAdapter.Fill(Me.NorthwindDataSet.Products)

    End Sub

   
    Private Sub UnitPriceTextBox_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles UnitPriceTextBox.Leave
        Dim i As Integer


        If Integer.TryParse(UnitPriceTextBox.Text, i) Then
            If i <= 0 Then
                MessageBox.Show("i timi den mporei na einai arnitiki")
                UnitPriceTextBox.Focus()
            End If
        Else
            MessageBox.Show("prepei na eisageis arithmo")
            UnitPriceTextBox.Focus()
        End If
    End Sub
End Class